const localStorage = require('../db/localStorage');

const loginDao = {
    login(login) {
        let { username, password } = login;
        let all_user = localStorage.get('user');
        for (let i = 0; i < all_user.length; i++) {
            let item = all_user[i];
            if (item.username === username && item.password === password) {
                return [{ username: item.username, id: item.id }];
            }
        }
        return [];
    }
};

module.exports = loginDao;